{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from astropy.io import fits\n",
    "from astronet.preprocess import generate_input_records\n",
    "from astronet.preprocess import preprocess\n",
    "from light_curve_util import keplersplinev2\n",
    "from light_curve_util import tess_io\n",
    "from matplotlib import pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "\n",
    "tess_data_dir = f'/mnt/tess/lc'\n",
    "reports_dir = f'/mnt/tess/rpt/png'\n",
    "tces_file = '/mnt/tess/astronet/tces-v3-all.csv'\n",
    "\n",
    "generate_input_records.FLAGS = generate_input_records.parser.parse_args([\n",
    "      '--tess_data_dir', '/mnt/tess/lc',\n",
    "      '--output_dir', '/dev/null',\n",
    "      '--input_tce_csv_file', tces_file,\n",
    "    ])\n",
    "\n",
    "tce_table = pd.read_csv(tces_file, header=0)\n",
    "tce = tce_table[tce_table.tic_id == 100139729]\n",
    "\n",
    "row = list(tce.iterrows())[0][1]\n",
    "\n",
    "import cProfile\n",
    "cProfile.run('generate_input_records._process_tce(row, 0.3, extended=True)', 'restats')\n",
    "\n",
    "import pstats\n",
    "from pstats import SortKey\n",
    "p = pstats.Stats('restats')\n",
    "p.strip_dirs().sort_stats('cumtime').print_stats()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
